package com.xxx.files;

import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

import java.io.File;
import java.io.IOException;

/**
 * @version v1.0
 * @Description:
 * @Author zhanzhongxin
 * @Date 2021/7/23 13:34
 * @Copyright 博为峰
 */
public class FileDemo {
    public static void main(String[] args) throws IOException {
//        m1();
//        m2();
//        m3();
//        File file = new File("C:\\Users\\zhanzhongxin\\Desktop\\java\\a\\b\\c");
//        file.mkdir();
//        file.mkdirs();

//        File file = new File("D:\\");
//        System.out.println(file.getTotalSpace() / 1024 / 1024);
//        System.out.println(file.getFreeSpace() / 1024 / 1024);
//        System.out.println(file.getUsableSpace() / 1024 / 1024);



    }

    private static void m3() {
        File file = new File("C:\\Users\\zhanzhongxin\\Desktop\\java\\a.txt");
//        System.out.println(file.createNewFile());

        File rename = new File("C:\\Users\\zhanzhongxin\\Desktop\\java\\a1.txt");
//        file.renameTo(rename);

        rename.delete();
    }

    private static void m2() {
        File file = new File("C:\\Users\\zhanzhongxin\\Desktop\\java\\IO.jpg");
        System.out.println("文件名:" + file.getName());
        System.out.println("文件路径:" + file.getPath());
        System.out.println("修改时间:" + file.lastModified());
        System.out.println("文件大小:" + file.length());
    }

    private static void m1() {
        File dir = new File("C:\\Users\\zhanzhongxin\\Desktop\\java");

        File file = new File("C:\\Users\\zhanzhongxin\\Desktop\\java\\IO.jpg");

        File file1 = new File(dir, "IO.jpg");
    }
}
